<!--
 * @Author: your name
 * @Date: 2021-09-23 14:39:22
 * @LastEditTime: 2021-09-23 17:38:01
 * @LastEditors: Please set LastEditors
 * @Description:上下布局的组件，常用场景:导航栏 数据展示
 * @FilePath: \uniapp-cil\src\components\x-up-down\x-up-down.vue
-->
<template>
  <view>
    <template v-if="mode == 'text'">
      <view class="u-flex u-flex-col" @click="click">
        <text class="" :style="[upStyle]">{{ up }}</text>
        <text class="color_9 u-font-28 u-m-t-10 f_w_500" :style="[downStyle]">{{ down }}</text>
      </view>
    </template>

    <template v-if="mode == 'nav'">
      <view class="u-flex u-flex-col" @click="click">
        <u-image
          :width="imageWidth"
          :shape="shape"
          :src="up"
          mode="widthFix"
        ></u-image>
        <text class="color_9 u-font-28 u-m-t-10 f_w_500" :style="[downStyle]">{{ down }}</text>
      </view>
    </template>
  </view>
</template>

<script>
export default {
  name: "upDown",
  props: {
    // 模型：text=文字上下  nav=图片文字上下
    mode: {
      type: String,
      default: "text",
    },

    //上面的字段名
    up: {
      type: [String, Number],
      required: true,
    },
    //下面的字段名
    down: {
      type: [String, Number],
      required: true,
    },
    // 上面的样式
    upStyle: {
      type: Object,
      default: () => {
        return {};
      },
    },

    // 下面的样式
    downStyle: {
      type: Object,
      default: () => {
        return {};
      },
    },
    shape: {
      type: String,
      default: "shape",
    },
    imageWidth: {
      default: "80",
      type: [String, Number],
    },
  },
  data() {
    return {};
  },
  methods: {
    click() {
      this.$emit("click");
    },
  },
};
</script>

<style lang="scss">
</style>
